<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title> while语句</title>
</head>
<body>
    <script>
//        var j=1;
//        do{
//            if(j%2==0){
//                console.log(j);
//                j++
//            }
//        }while(j<=10);

        //1+2+3+4+...100=?

        var sum=0;
        var n=1;
        while (n<=100){
            sum+=n; //sum=sum+n;
            n++;
        }
        console.log(sum);
    </script>
</body>
</html>